using System;
using System.IO;
using RPGOnline.Remoting.Entities;

namespace RPGOnline.Controls.Chat
{
    public class ChatLogger
    {
        private StreamWriter m_fileStream;

        public ChatLogger()
        {
            string fileName = string.Format("Log-" + DateTime.Now.ToString("dd-MM-yyyy HH.mm.ss") + ".txt");
            m_fileStream = new StreamWriter(File.OpenWrite(fileName));
            m_fileStream.AutoFlush = true;
        }

        public void Log(string message)
        {
            m_fileStream.WriteLine(message);
            m_fileStream.Flush();
        }
    }
}